<?php

namespace App\Http\Controllers\Api\V1\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class TestTopicResource extends JsonResource
{
    public function toArray($request)
    {
    	$data = $this->resource;
    	
        return [
	        'id' 				=> (int)$data->id,
	        'title' 			=> (string)$data->title,
	        'answer'           => (string)$data->answer,
	        'questions' => $this->questions()->orderby('question_option')->get(),
        ];
    }
}
